<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>05_JS运算符</title>
</head>
<body>
<script>
    console.log(6/2);
    console.log(3/2);

    //比较运算符
    //如果比较运算符任意一侧有数字，会将非数字转换成数字
    //如果比较运算符任意一侧有字符串，比较的是字符串的编码
    //‘3331’.charCodeAt()获取指定下标处的字符的编码，默认取第一个字符的编码
    console.log(3>10);
    console.log('3'>10);
    console.log(3>'10');
    console.log('3'.charCodeAt());
    console.log('10'.charCodeAt());
    console.log('3'>'10');
    console.log('超'.charCodeAt());
    console.log('语'.charCodeAt());
    console.log('超'>'语');
    console.log('33331'.charCodeAt(4));

    let a =1;
    let b = true;
    console.log(a==b);//松散比较符：只比较值
    console.log(a===b);//严格比较符：先比较数据类型，类型一致在比较值

    let c = 0;
    console.log(c==0?'YES':'NO')
    console.log(c=0?'YES':'NO')//=是赋值运算，先把0赋给c，然后转换为布尔类型得到false，所以结果是NO



</script>
</body>
</html>